package org.elsfs.cloud.common.mybatis.ext.sql;


import lombok.AccessLevel;
import lombok.Getter;
import org.apache.commons.compress.utils.Lists;
import org.elsfs.cloud.common.mybatis.ext.sql.support.condition.ConditionItem;

import java.util.List;

/**
 * 抽象或条件构建器实现
 *
 * @param <P> 上级对象类型

 */
@Getter(AccessLevel.PACKAGE)
public abstract class AbstractOrCondition<P extends Condition<P>> extends AbstractCondition<AbstractOrCondition<P>> implements OrCondition<AbstractOrCondition<P>, P> {

    /**
     * 条件项列表
     */
    private final List<ConditionItem> conditionItems = Lists.newArrayList();

    /**
     * 添加一个条件
     *
     * @param conditionItem 条件
     */
    @Override
    protected void addConditionItem(ConditionItem conditionItem) {
        this.conditionItems.add(conditionItem);
    }
}
